<template>
  <div class="download-box">
    <img src="../assets/img/icon_yueyexia.png" alt="" srcset="" />
    <p>下载APP，体验完整功能</p>
    <div class="down-btn" @click="download">立即下载</div>
  </div>
</template>

<script>
import { isIOS, isAndroid, isWeixin } from "../assets/utils/util";
export default {
  data() {
    return {
      isIOS: "",
      isAndroid: "",
      isWeixin: ""
    };
  },
  mounted() {
    this.isWeixin = isWeixin();
    this.isIOS = isIOS();
    this.isAndroid = isAndroid();

    if (this.isIOS) {
      window.location.href = `yueyexia://?id=${this.topicID}&type=14`;
      return false;
    }
    if (this.isAndroid) {
      window.location.href = `yueyexia://?id=${this.topicID}&type=14`;
      return false;
    }
  },
  methods: {
    download() {
      if (this.isIOS) {
        window.location.href =
          "https://itunes.apple.com/cn/app/%E8%B6%8A%E9%87%8E%E4%BE%A0/id1354367645?mt=8";
        return false;
      }
      if (this.isAndroid) {
        window.location.href =
          "http://android.myapp.com/myapp/detail.htm?apkName=com.yueyexia.app";
        return false;
      }
    }
  }
};
</script>

<style lang="stylus" scoped>
.download-box
    width 100vw
    height 100vh
    display flex
    justify-content center
    align-items center
    flex-direction column
    color #333333
    img
        display block
        width 100px
        height 100px
        border-radius 8px
    p
        text-align center
        font-size 16px
        margin 20px 0 60px
    .down-btn
        width 254px
        height 50px
        background rgba(255,229,87,1)
        box-shadow 0px 2px 8px 0px rgba(255,200,11,0.5)
        border-radius 25px
        text-align center
        line-height 50px
        font-size 18px
</style>
